package com.zutclassdemo.mapper;

import com.zutclassdemo.entity.TRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author blackTry
 * @since 2021-04-27
 */
public interface TRoleMapper extends BaseMapper<TRole> {

    @Select("select DISTINCT t_role.`name` FROM\n" +
            "t_role,t_admin,t_admin_role\n" +
            "where t_admin.id = t_admin_role.admin_id\n" +
            "and t_role.id = t_admin_role.role_id\n" +
            "and t_admin.id = #{id}")
    List<TRole> getRoleById(Integer id);
}
